home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / VideoToolbox 97.08.16 / (Utilities) / ReadLuminanceMeter / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-26  |  2.0 KB  |  78 lines  |  [TEXT/CWIE]

  1. /* main.c  
  2.  
  3.     Demo program code for measuring luminance using the Minolta LS-110/100 luminance
  4.     meters.
  5.     If there's no meter attached to the computer, the program will simply give a
  6.     message that there was no data available within a certain period.
  7.  
  8.     Please send suggestions, bugs, improvements, comments to f.w.cornelissen@med.rug.nl    
  9.     Details in "read me" file and luminance.c file. Use at your own risk.
  10.  
  11.     26-02-97    fwc        created it
  12. */
  13.  
  14. #if __MWERKS__
  15.     #include     "SIOUX.h"
  16. #endif
  17.  
  18. #include     "luminanceMeter.h"
  19.  
  20. #define PORT PRINTER_PORT        // set to PRINTER_PORT or MODEM_PORT
  21.  
  22. void     main( void );
  23. void     changeConsoleSettings( void );
  24. void     wait( double sec );
  25.  
  26. void main( void )
  27. {
  28.     int i = 0;
  29.     double lum=0;
  30.     char text[ 256 ];
  31.     EventRecord event;
  32.  
  33.     changeConsoleSettings( );
  34.     printf( "\nTest Program for Minolta LS110 Luminance meter\n" );
  35.     
  36.     printf( "Program set for use with %s.\n", returnPortName( PORT ) );
  37.     printf( "\n Click the mouse or hit a key to continue......\n" );
  38.     
  39.     FlushEvents( everyEvent, 0 );
  40.     while( !EventAvail(keyDownMask+mDownMask, &event ) ) ;
  41.     
  42.     printf( "\n Initiating luminance meter\n" );
  43.     initLuminanceMeter( PORT );
  44.     printf( "\nStarting measurements.\n");
  45.     printf( "\n Click the mouse or hit a key to stop......\n\n" );
  46.     FlushEvents( everyEvent, 0 );
  47.     while( !EventAvail(keyDownMask+mDownMask, &event ) )
  48.     {
  49.         if( getLuminance( &lum, text ) )    // no error
  50.             printf( "Nr: %  d, lum: %  6.2f, %s\n", i++, lum, text );
  51.         else                                // error
  52.             printf( "Nr: %d, message: %s\n", i++, text );
  53.     }
  54.  
  55.     endLuminanceMeter();
  56.     printf( "\nSession finished, goodbye\n" );
  57.  
  58. }
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. void changeConsoleSettings( void )
  66. {
  67.     #if __MWERKS__
  68.         SIOUXSettings.toppixel=LMGetMBarHeight()+19;    // allow for menu bar and title bar
  69.         SIOUXSettings.leftpixel=1;
  70.         SIOUXSettings.rows=40;
  71.         SIOUXSettings.columns=(qd.screenBits.bounds.right)/(SIOUXSettings.fontsize*5/4)-1;
  72.         SIOUXSettings.autocloseonquit=0;
  73.         SIOUXSettings.showstatusline=0;
  74.         SIOUXSettings.asktosaveonclose=0;
  75.         printf("\n");
  76.     #endif
  77. }
  78.